package chp05.homework;

import java.util.Scanner;

public class Home3 {

    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        //保存最大值
        int max = 0;
        //保存最小值
        int min = 101;
        while (true){
            System.out.print("输入一个1-100的整数(输入0结束):");
            int num = input.nextInt();
            if(num == 0){
                break;
            }
            //打擂台，大的留下
            if(num > max){
                max = num;
            }
            //打擂台，小的留下
            if(num < min){
                min = num;
            }
        }
        System.out.println("最大值:"+max);
        System.out.println("最小值:"+min);
    }
}
